﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.IO;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                string path = Path.GetTempFileName();
                int index = path.LastIndexOf('.');
                path = path.Remove(index);

                Console.WriteLine(path + ".xls");
                Console.ReadLine();

                Uri serviceUri = new Uri("http://10.0.0.201:6666/WcfResultPointService/FileProcessingService");
                BasicHttpBinding serviceBinding = new BasicHttpBinding();
                serviceBinding.Security.Mode = BasicHttpSecurityMode.None;
                serviceBinding.MaxReceivedMessageSize = int.MaxValue;
                serviceBinding.ReaderQuotas.MaxStringContentLength = int.MaxValue;
                
                var channelFactory = new ChannelFactory<httpWcfResultPoint>(serviceBinding, new EndpointAddress(serviceUri));
                //channelFactory.Credentials.UserName.UserName = @"tnotest\spadmin";
                //channelFactory.Credentials.UserName.Password = @"Admin123!";

                //Create a channel
                var channel = channelFactory.CreateChannel();

                string json = channel.GetUniversities();

                channelFactory.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            Console.ReadLine();
        }
    }
}
